//
// Created by xili on 2024/8/3 10:44.
// Go big or go home.
//
#include <vector>

using namespace std;

class Solution {
public:
    int numEquivDominoPairs(vector<vector<int>> &dominoes) {
        int ans = 0;
        vector<int> help(100, 0);
        for (auto &item: dominoes) {
            int num = item[0] > item[1] ? item[1] * 10 + item[0] : item[0] * 10 + item[1];
            ans += help[num];
            help[num]++;
        }
        return ans;
    }
};